package main

import (
	"eat-every-day/global"
	"eat-every-day/internal/middleware"
	"eat-every-day/internal/routers"
	"eat-every-day/pkg/logs"
	"github.com/gin-gonic/gin"
	"net/http"
)

func main() {
	//controller.InitController()

	r := gin.New()
	routers.Load(
		r,
		gin.Logger(),
		middleware.Logging(),
		middleware.Cors(),
	)

	logs.Log.Info("Start Http Server，Listen Port：", global.ServerSetting.HttpPort)
	s := &http.Server{
		Addr:         ":" + global.ServerSetting.HttpPort,
		Handler:      r,
		ReadTimeout:  global.ServerSetting.ReadTimeout,
		WriteTimeout: global.ServerSetting.WriteTimeout,
	}
	logs.Log.Error("Start Http Server Failed：", s.ListenAndServe())
}
